package com.itms.service;

import com.itms.mapper.TableDataSyncMapper;
import com.itms.pojo.TableDataSync;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class SycService {

    @Autowired
    private TableDataSyncMapper tableDataSyncMapper;

     public void  save(Date date,String tableName){
         TableDataSync t = new TableDataSync();
         t.setSyncTime(date);
         t.setDataCreateTime(new Date());
         t.setIsSync(true);
         t.setTableName(tableName);
         this.tableDataSyncMapper.insertSelective(t);
    }

    public Date getMaxSyncDate(String tableName){
        return this.tableDataSyncMapper.findByTableName(tableName);
    }
}
